package com.itheima;

import java.util.Random;

public class test04 {
    public static void main(String[] args) {
        //int arr = new int[5];
        int[] arr = new int[5];
        Random r = new Random();
        for (int i = 0; i < arr.length; i++) {
            i = r.nextInt(99)+1;
            arr[i] = r.nextInt(99)+1;
        }
        System.out.println();
        //comp()
        comp(arr);
    }
    public static void comp(int[] arr){
        int max = arr[0];
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if(max<arr[i]){
                // arr[i]= max;
                max = arr[i];
                //if else(min >arr[i]){
            }else if (min >arr[i]){
                min = arr[i];
            }
        }
        System.out.println("最大值为"+max);
        System.out.println("最小值为"+min);
    }
}
